import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

const resolve = (dir: string) => path.join(__dirname, dir)

export default defineConfig({
  base: '/ld-link/',
  plugins: [
    vue(),
  ],
  resolve: {
    alias: {
      '@': resolve('src'),
      '_P': resolve('public')
    }
  },
  server: {
    proxy: {
      '/api-radar-service': {
        target: 'http://121.37.43.233:18090/radar-service/',
        changeOrigin: true,
        rewrite: path => path.replace(/^\/api-radar-service\//, '')
      },
      '/demo': {
        target: 'http://10.1.80.122:8000/',
        changeOrigin: true,
        rewrite: path => path.replace(/^\/demo/, '')
      }
    }
  }
})
